﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BusinessLogic;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        public UserInfo CurUser
        {
            get
            {
                return (UserInfo)Session["curUser"];
            }
            set 
            {
                Session["curUser"] = value;
            }
        }

        public bool IsLogged
        {
            get 
            {
                return CurUser != null;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsLogged)
            {
                GridView1.DataSource = CurUser.getEvents();
                GridView1.DataBind();
            }
        }

        protected void onLogin(object sender, EventArgs e)
        {
            CurUser = UserExtensions.getByLoginPassword(TextBox1.Text, TextBox2.Text);
        }
    }
}
